package com.tenbent.product.base.filter;

import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by ThinkPad on 2017/7/25.
 */
public class MyFilter extends OncePerRequestFilter {

	// TODO 可以写一些要过滤的属性，get，set 方法
	private String filterUrl;

	public MyFilter(String filterUrl) {
		this.filterUrl = filterUrl;
	}

	@Override
	protected void doFilterInternal(HttpServletRequest req, HttpServletResponse resp, FilterChain filterChain)
			throws ServletException, IOException {
		logger.info("request is in doFilter(MyFilter).....!");
		// TODO 业务逻辑
		filterChain.doFilter(req, resp);
	}

	public String getFilterUrl() {
		return filterUrl;
	}

	public void setFilterUrl(String filterUrl) {
		this.filterUrl = filterUrl;
	}
}
